
package com.jf.cloud.api.product.feign;

import com.jf.cloud.common.feign.FeignInsideAuthConfig;
import com.jf.cloud.common.order.vo.ShopCartItemVO;
import com.jf.cloud.common.response.ServerResponseEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author zz
 * @date 2020/11/12
 */
@FeignClient(value = "jfcloud-product",contextId = "shopCart")
public interface ShopCartFeignClient {

    /**
     * 获取购物项
     * @return 购物项
     */
    @GetMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/shopCart/getById")
    ServerResponseEntity<List<ShopCartItemVO>> getCheckedShopCartItems(@RequestParam("addrId")Long addrId);

    /**
     * 通过购物车id删除用户购物车物品
     * @param shopCartItemIds 购物车id
     * @return
     */
    @DeleteMapping(FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/delete_item")
    ServerResponseEntity<Void> deleteItem(@RequestBody List<Long> shopCartItemIds);

    /**
     * 根据店铺id列表更新购物车店铺是否停业属性
     * @param shopIds
     * @param isClosed
     * @return
     */
    @PutMapping(FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/updateIsClosedByShopIds")
    ServerResponseEntity<Void> updateIsClosedByShopIds(@RequestBody List<Long> shopIds, @RequestParam(value = "isClosed") Integer isClosed);

    /**
     * 套餐发生变化时移除用户购物车项
     * @param comboIdList
     * @param spuId
     * @param skuId
     * @return
     */
    @PutMapping(FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/shopCart/deleteCartByComboUpdate")
    ServerResponseEntity<Void> deleteCartByComboUpdate(@RequestParam("comboIdList") List<Long> comboIdList,@RequestParam("spuId") Long spuId,@RequestParam("skuId") Long skuId);

    /**
     * 根据套餐id和套餐商品id集合移除用户购物车项
     * @param comboId
     * @param spuIdList
     * @return
     */
    @PutMapping(FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/shopCart/deleteCartByComboIdAndSpuIdS")
    ServerResponseEntity<Void> deleteCartByComboIdAndSpuIdS(@RequestParam("comboId") Long comboId,@RequestParam("spuId") List<Long> spuIdList);

    /**
     * 根据套餐id和套餐商品id集合移除用户购物车项
     * @param comboId
     * @param skuIdList
     * @return
     */
    @PutMapping(FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/shopCart/deleteCartByComboIdAndSkuIdS")
    ServerResponseEntity<Void> deleteCartByComboIdAndSkuIdS(@RequestParam("comboId") Long comboId,@RequestParam("skuIdList") List<Long> skuIdList);

    /**
     * 修改用户购物车中的套餐商品价格
     * @param comboId
     * @param skuId
     * @param price
     * @return
     */
    @PutMapping(FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/shopCart/updateCartSpuPriceByComboIdAndSkuId")
    ServerResponseEntity<Void> updateCartSpuPriceByComboIdAndSkuId(@RequestParam("comboId") Long comboId,@RequestParam("spuId") Long skuId,@RequestParam("price") Long price);

    /**
     * 根据套餐主商品skuId获取搭配商品id
     * @param skuId
     * @return
     */
    @GetMapping(FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/shopCart/skuIdListByComboMainSkuId")
    ServerResponseEntity<List<Long>> skuIdListByComboMainSkuId(@RequestParam("skuId") List<Long> skuId);

    /**
     * 套餐修改商品起搭数时异步修改以后购物车商品数量
     * @param comboId 套餐id
     * @param spuId 商品id
     * @param count 套餐商品起搭数量
     * @return
     */
    @GetMapping(FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/shopCart/updateCartComboCount")
    ServerResponseEntity<Void> updateCartComboCount(@RequestParam("comboId") Long comboId, @RequestParam("spuId") Long spuId, @RequestParam("count") Integer count);
}
